@echo off
echo Generating protobuf code...

REM 检查protoc是否安装
where protoc >nul 2>nul
if %ERRORLEVEL% NEQ 0 (
    echo Error: protoc not found. Please install Protocol Buffers compiler.
    echo Download from: https://github.com/protocolbuffers/protobuf/releases
    exit /b 1
)

REM 生成Go代码
protoc --go_out=. --go_opt=paths=source_relative proto/war3.proto

if %ERRORLEVEL% EQU 0 (
    echo Protobuf code generated successfully!
) else (
    echo Error: Failed to generate protobuf code.
    exit /b 1
)
